ENVI::OpenVector

The OpenVector function method creates a new ENVIVector from a file or URI.

Example

; Launch the application

e = ENVI()

 

; Open a shapefile

file = FILEPATH('states.shp', $

  SUBDIRECTORY = ['examples', 'data'])

 

; Create an ENVIVector from the shapefile data

vector = e.OpenVector(file)

Syntax

Result = ENVI.OpenVector(URI [, Keywords=value])

Return Value

This method returns a reference to an ENVIVector.

Arguments

URI

Specify a scalar string that is a fully qualified file path to a vector file on disk. Supported formats include shapefiles, GeoPackage files, and ENVI Vector Files (.evf).

For remote datasets, specify a string with the direct URL of the dataset. You can connect directly to Open Geospatial Consortium (OGC) Web Feature Service (WFS) server.

The connection string is formatted the same as the URL field in the Open Remote Dataset dialog. See Using the Open Remote Dataset Dialog for examples of connection strings. If you connect to a remote dataset that requires authentication, you must set the USERNAME and PASSWORD keywords. Or, optionally set the /PROMPT_USER keyword to enter the user name and password.

Keywords

Keywords are applied only during the initial creation of the object.

ERROR

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

PASSWORD

Set this keyword to a string with a valid password for opening a remote dataset that requires authentication.

STANAG_4676

Set this keyword to a string with a valid STANAG 4676 .xml file or array of .xml files to open and create a shapefile of the points.

USERNAME

Set this keyword to a string with a valid user name for opening a remote dataset that requires authentication.

Version History

ENVI 5

Introduced

ENVI 5.2.1

Added PASSWORD and USERNAME keywords

ENVI 5.3

Updated URI to include GeoPackage files

ENVI 5.6

Added support for OGC WFS datasets

ENVI 5.6.2 Added STANAG_4676 keyword

API Version

4.2

See Also

ENVI function, ENVIVector, ENVIVector::Close